package com.waiting.bigDecimal;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.DecimalFormat;

/**
 * @desctiption
 * @Author bjweitingting
 * @date 2018/5/3
 **/
public class Main {
    // 格式化百分比
    private static DecimalFormat profitFormat = new DecimalFormat("#.00");

    public static void main(String[] args) {
        BigDecimal wave = BigDecimal.valueOf(101);
        BigDecimal hangqing = BigDecimal.valueOf(3925);
        Double AppointLever = new Double(20);
        BigDecimal tmp = BigDecimal.valueOf(AppointLever);
        BigDecimal test=BigDecimal.valueOf(100);
        System.out.println(wave.divide(hangqing, 7, RoundingMode.HALF_DOWN)
                );
        System.out.println(wave.divide(hangqing, 7, RoundingMode.HALF_UP)
        );
//        Double profit = wave.divide(hangqing, 8, RoundingMode.HALF_DOWN).multiply(tmp).multiply(test).doubleValue();
//        System.out.println(profit.doubleValue());
//        System.out.println(new String(profitFormat.format(profit.doubleValue())));

        Double profit = wave.divide(hangqing, 7, RoundingMode.HALF_UP)
                .doubleValue() * AppointLever.doubleValue() * 100;
        Double temp=new Double(51.479);
        System.out.println(new String(profitFormat.format(temp)));
        System.out.println(new String(profitFormat.format(profit.doubleValue())));
    }
}
